Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

361
Vistas
Transition between images on an image slideshow instead of "white" flash on the page

I have a slideshow of images (that changed when I click on different options. So the images don't change automatically) and even tho I first preload all of the images when the application is loaded ( I have all of this in react ) it still "flashes white" between them. The preload code:

    useEffect(() => {
        setPreloaded(false)
        const preLoadImages = function preLoadImages(imageUrl, numberOfImagesPerColumn) {
            const promises = [];
            for (let index = 0; index < numberOfImagesPerColumn; index++) {
                const fImgUrl = `${imageUrl}${index + 1}.${t}`;
                promises.push(loadImage(fImgUrl).catch((err) => {
                    //  TODO: Handle 404 Error
                }));
            }
            return Promise.all(promises);
        };

        function loadImage(src) {
            return new Promise(((resolve, reject) => {
                const img = new Image();
                img.onload = function () {
                    resolve(img);
                };
                img.onerror = function () {
                    reject(src);
                };
                img.src = src;
            }));
        }

        preLoadImages(p, n).then(() => {
            setPreloaded(true);
        });
    }, [p]);

How can I make a smooth transition between them or like the old image will still stay until the new one is loaded completely and will transition without a "white flash" between them ?

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda